<?php

namespace App\Models\Banner;

use Illuminate\Database\Eloquent\Model;

class LiveBanner extends Model
{
    public $table = 'live_banner';
    public $timestamps = false;

    #根据类型获取轮播图
    public static function getBannerByType(int $type)
    {
        $banner = self::query()->where('type','=',$type)->select('banner','banner_title','banner_url')->orderBy('sort','asc')->get();
        if (empty($banner)){
            return [];
        }else{
            return $banner;
        }
    }
}
